package com.watson;

import android.content.Intent;
import android.os.Bundle;


import com.watson.utils.SPUtils;

import java.util.Timer;
import java.util.TimerTask;

public class StartActivity extends Base2Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setBackgroundDrawableResource(android.R.color.white); // 使用你的应用的主题颜色
        setContentView(R.layout.activity_start);
        statusBar();
    }


    @Override
    protected void onResume() {
        super.onResume();
        TimerTask task = new TimerTask() {
            @Override
            public void run() {
                /**
                 *要执行的操作
                 */
                boolean userType = (Boolean) SPUtils.get(mContext, "userType", false);
                if (userType) {
                    startActivity(new Intent(mContext, MainActivity.class));
                } else {
                    startActivity(new Intent(mContext, LoginActivity.class));
                }
                finish();
            }
        };
        Timer timer = new Timer();
        timer.schedule(task, 1500);
    }
}
